/*12/30/93: Random number generator works on SparcStation */
#include <stdio.h>
#include <math.h>
#define a (double) 16807.0
#define m (double) 2147483647.0
float random, randomvar();
long garb;
double temp, seed;

int i=1;
main()
{	seed=1;
	printf("Initial seed=%10.2f\n", seed);
	printf("______________________________________________\n");
	while(i<10001)
	{	randomvar();
		if(i<11) printf("%5d seed=%10.0f num=%f\n", i, seed, random);
		i++;
	}
	printf("%3d seed=%10.0f num=%f\n", i, seed, random);
}
float randomvar()
{       temp=a*seed;
        garb=(int)(temp/m);
        seed=temp-m*(double)garb;
	random=seed/m;
	return random;
 }

